<template>
  <view class="page">
    <!-- 顶部渐变 + 进度条 -->
    <view class="progress-area">
      <view class="bar"><view class="bar-fill" :style="'width:'+progress+'%;'"><view class="bar-thumb"></view></view></view>
      <view class="steps"><view class="step active">残疾人证认证</view><view class="step">身份证认证</view></view>
    </view>

    <view class="content">
      <view class="label">残疾人证正面</view>
      <view class="upload-card" @tap="pick('front')">
        <view class="left"><view class="title">正面</view><view class="sub">上传您残疾人证正面</view></view>
        <image class="preview-img" :src="imgs.front || img_src" mode="aspectFit" />
      </view>

      <view class="spacer"></view>

      <view class="label">残疾人证背面</view>
      <view class="upload-card" @tap="pick('back')">
        <view class="left"><view class="title">背面</view><view class="sub">上传您残疾人证背面</view></view>
        <image class="preview-img" :src="imgs.back || img_src" mode="aspectFit" />
      </view>

      <view class="bottom-gap"></view>

      <view class="cta-wrap"><button class="cta" @tap="toIDUpload">上传身份证信息</button></view>
      <view class="skip">没有残疾人证，<text class="link" @tap="skipDisability">点击跳过</text></view>
    </view>
  </view>
</template>

<script>
const PLACEHOLDER_IMG = 'https://kehu-1256834579.cos.ap-shanghai.myqcloud.com/weier/zhengjian.png';
export default {
  data() {
    return {
      progress: 58,
      imgs: { front: '', back: '' },
	  img_src:'https://kehu-1256834579.cos.ap-shanghai.myqcloud.com/weier/zhengjian.png'
    };
  },
  methods: {
    goBack() {
      if (getCurrentPages().length > 1) { uni.navigateBack(); }
      else { uni.switchTab({ url: '/pages/home/home' }); }
    },
    onMenu() {
      uni.showActionSheet({
        itemList: ['帮助', '联系客服'],
        success: (r) => { if (r.tapIndex === 0) uni.showModal({ title: '帮助', content: '请上传清晰无遮挡的证件照片。' }); }
      });
    },
    onScan() { uni.showToast({ title: '扫码', icon: 'none' }); },
    pick(side) {
      uni.chooseImage({
        count: 1, sizeType: ['compressed'],
        success: (res) => { this.imgs[side] = res.tempFilePaths[0]; }
      });
    },
    toIDUpload() { uni.navigateTo({ url: 'idcard' }); },
    skipDisability() { uni.navigateTo({ url: 'idcard' }); }
  }
};
</script>

<style lang="scss" scoped>
@import "renzheng.scss";
</style>
